package main

import (
	"io"
	"os"

	log "github.com/sirupsen/logrus"
	"github.com/streadway/amqp"
)

func main() {
	initLogger()
	conn, err := amqp.Dial("amqp://guest:guest@192.168.0.113:5672/")
	if err != nil {
		log.Fatalf("Failed to connect to RabbitMQ: %v", err)
	}
	defer conn.Close()
	log.Info("Connected to RabbitMQ")
}

func initLogger() {
	file, _ := os.OpenFile("server.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
	mw := io.MultiWriter(os.Stdout, file)
	log.SetFormatter(&log.JSONFormatter{})
	log.SetOutput(mw)
}

type Connection struct {
	Server   string
	Port     int
	User     string
	Password string
}
